//
//  DetailTableViewController.m
//  随拍
//
//  Created by lanou3g on 16/1/18.
//  Copyright © 2016年 Ashoka. All rights reserved.
//

#import "DetailTableViewController.h"
#import "DetailTableViewCell.h"



@interface DetailTableViewController ()

@property(nonatomic,strong)UIView *headerView;

@property(nonatomic,strong)UILabel *locLabel;

@end

@implementation DetailTableViewController

NSString *identfire = @"cell";
NSString *ident = @"TwoCell";

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.tableView = [[UITableView alloc] initWithFrame:[UIScreen mainScreen].bounds style:UITableViewStylePlain];
    [self.tableView registerClass:[DetailTableViewCell class] forCellReuseIdentifier:identfire];

    [self headerView:self.tableView ];
    

    
}





-(void)headerView:(UITableView *)tableView{
    
    self.headerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 500)];
    self.headerView.backgroundColor = [UIColor lightGrayColor];
    self. locLabel = [[UILabel alloc] initWithFrame:CGRectMake(15, self.headerView.bounds.size.height -40, 30, 30)];
    
    _locLabel.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"location.png"]];
    _locLabel.textColor = [UIColor redColor];
    
    
    self.tableView.tableHeaderView = self.headerView;
    
    [self.headerView addSubview:_locLabel];
    
    
    
    
    
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    
}



#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    
    
    
    return 3;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    
    if ( section == 0) {
        return 1;
    }else if( 1 == section){
        return 1;
    }else{
        return 3;
    }
    return 0;
    
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    if (indexPath.section == 0 && indexPath.row == 0) {
        DetailTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identfire forIndexPath:indexPath];
        return cell;
        
    }else{
        
      DetailTableViewCell *cell1 = [tableView dequeueReusableCellWithIdentifier:ident forIndexPath:indexPath];

        return cell1;
    }
    
    
    
    
    //    return cell;
}


-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    if (indexPath.section == 0 && indexPath.row == 0) {
        return 100;
    }else if ( indexPath.section == 0 &&  indexPath.row == 1) {
        return 80;
    }else{
        return 100;
    }
    
    //    return 100;
}
-(NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section{
    if (section == 1) {
        return  @"YOU JUMP ";
    }else if (section == 2){
        return @"I SEE YOU JUMP";
    }else{
        return nil;
    }
}


/*
// Override to support conditional editing of the table view.
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
    // Return NO if you do not want the specified item to be editable.
    return YES;
}
*/

/*
// Override to support editing the table view.
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
    if (editingStyle == UITableViewCellEditingStyleDelete) {
        // Delete the row from the data source
        [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade];
    } else if (editingStyle == UITableViewCellEditingStyleInsert) {
        // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
    }   
}
*/

/*
// Override to support rearranging the table view.
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath {
}
*/

/*
// Override to support conditional rearranging of the table view.
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath {
    // Return NO if you do not want the item to be re-orderable.
    return YES;
}
*/

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
